/*
* Main.cpp
*
*  Created on: Jan 20, 2011
*      Author: Team MRF
*/


#include <iostream>
using namespace std;

#include "Simulation.h"
using namespace gsp280Project2;

typedef unsigned short pShort;


//Global Variables...
pShort mass = 32;
float radius = 5;

// 30 degrees (.52 rads)
float omega, angle, launchX, launchY, targetX, targetY; //float angle = 30, launchX = 5, launchY = 10, targetX = 200, targetY = 50;
char yesNo_Loop = 'y', yesNo_SameInput = 'y';


void userInput();
void welcome();

int main()
{
	Simulation sim;
	welcome();

	userInput();

	do {
		// Angle is fed into Start() as degrees
		sim.Start(mass, radius, omega, angle, Vector2(launchX, launchY), Vector2(targetX, targetY));
		sim.displaySummary();

		cout << "Try Again (y/n)? ";  cin >> yesNo_Loop;

		if ( (yesNo_Loop == 'n') || (yesNo_Loop == 'N') )
		{
			sim.Stop();
		}
		else
		{
			cout << "\nEnter New Input Values? (y/n)? ";  cin >> yesNo_SameInput;

			if ( (yesNo_SameInput == 'y') || (yesNo_Loop == 'Y') ) { userInput(); }
		}

	} while ( (yesNo_Loop == 'y') || (yesNo_Loop == 'Y') );

	return (0);
}

void userInput()
{
	cout << "\nPlease enter the following information:\n\nMass: ";
	cin >> mass;

	cout << "\nRadius: ";
	cin >> radius;
	
	cout << "\nAngular Velocity: ";
	cin >> omega;

	cout << "\nAngle: ";
	cin >> angle;

	cout << "\nLaunch Object Location (X Y): ";
	cin >> launchX;
	cin >> launchY;

	cout << "\nTarget Object Location (X Y): ";
	cin >> targetX;
	cin >> targetY;

	cout << "\n\n";

}

void welcome()
{
	cout << "\n===========================================================\n";
	cout << "\tWelcome to the Catapult Simulation Program!\n";
	cout << "===========================================================\n";
}
